<template>
  <div class="audition179">
    <v-md-preview :text="text1" />
    <p>requirejs 导入模块的方式实际就是创建脚本标签，一切的模块都需要经过这个方法创建。</p>
    <p>requirejs 使用 onload 事件来处理回调函数</p>
  </div>
</template>

<script>
const prefix = '``` js'
const suffix = '```'
export default {
  name: 'Audition179',
  data() {
    return {
      text1: `${prefix}
      /**
      * Creates the node for the load command. Only used in browser envs.
      */
      req.createNode = function (config, moduleName, url) {
        var node = config.xhtml ?
        document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
        document.createElement('script');
        node.type = config.scriptType || 'text/javascript';
        node.charset = 'utf-8';
        node.async = true;
        return node;
      };
      \n${suffix}`,
    }
  }
}
</script>

<style>

</style>